﻿<%@ Page Title="" Language="C#" MasterPageFile="~/backend/Admin.Master" AutoEventWireup="true" CodeBehind="KidHealthDetails.aspx.cs" Inherits="mamnontuoitho7.backend.KidHealthDetails" %>
<%@ Import Namespace="mamnontuoitho7.AppCode" %>

<asp:Content ID="Content1" ContentPlaceHolderID="AdminTitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<script type="text/javascript" language="javascript">
    function Save() {

        var weight = trim(document.getElementById("<%= txtKidWeight.ClientID %>").value);
        var height = trim(document.getElementById("<%= txtKidHeight.ClientID %>").value);

        if (!/<%= ConstantClass.testFloatNumber %>/.test(weight)) {
            alert("Cân nặng của bé không để trống và ở dạng thập phân.\n Vd: 123 hay 12.33")
            document.getElementById("<%= txtKidWeight.ClientID %>").focus();
            return false;
        }

        if (!/<%= ConstantClass.testFloatNumber %>/.test(height)) {
            alert("Chiều cao của bé không để trống và ở dạng thập phân.\n Vd: 123 hay 12.33")
            document.getElementById("<%= txtKidHeight.ClientID %>").focus();
            return false;
        }

    }

    function trim(str) {
        return str.replace(/^\s+|\s+$/g, "");
    }
</script>


<!-- Begin one column tab content window -->
    <div class="onecolumn">
	    <div class="header">
		    <span>Thông tin sức khỏe của bé <%= hidKidFullName.Value %></span>
		    <div class="switchbutton">
                  <a href="KidEdit.aspx?hidKidID=<%=hidKidID.Value%>&hidNamePage=<%= hidNamePage.Value%>&hidClassID=<%= hidClassID.Value%>&hidClassName=<%= hidClassName.Value%>&hidParentID=<%=hidParentID.Value%>" class="buttons stylebutton">Quay lại</a>
		    </div>
	    </div><br class="clear"/>

	    <div class="content">
		    <div id="tab1_content" class="tab_content">
                <form id="form2" runat="server">
                    <div>
                        <asp:Panel ID="Panel1" DefaultButton="btnSave" runat="server">
                            <div class="wrapper">
                                <div class="tab_textedit70">Cân nặng</div>
                                <div class="tab_textedit70">: <asp:TextBox ID="txtKidWeight" runat="server" CssClass="tab_textstyle" style="width:35px;"></asp:TextBox> kg.</div>
                                <div class="tab_textedit70 fl_space">Tình trạng</div>
                                <div class="tab_textedit">: <asp:TextBox ID="txtWeightNotice" runat="server" MaxLength="200" CssClass="tab_textstyle" style="width:380px;"></asp:TextBox></div>
                            </div><br class="clear"/>
                            <div class="wrapper">
                                <div class="tab_textedit70">Chiều cao</div>
                                <div class="tab_textedit70">: <asp:TextBox ID="txtKidHeight" runat="server" CssClass="tab_textstyle" style="width:35px;"></asp:TextBox> cm.</div>
                                <div class="tab_textedit70 fl_space">Tình trạng</div>
                                <div class="tab_textedit">: <asp:TextBox ID="txtHeightNotice" runat="server" MaxLength="200" CssClass="tab_textstyle" style="width:380px;"></asp:TextBox></div>
                            </div><br class="clear"/>
                            <div class="wrapper">
                                <div class="tab_textedit70">Kết luận</div>
                                <div class="tab_areaedit">: <asp:TextBox ID="txtResult" runat="server" MaxLength="4000" CssClass="tab_textstyle" style="width:530px;"></asp:TextBox><br />
                                    <p style="float:left; margin:5px 0 0 -10px;">
                                        <asp:Button runat="server" ID="btnSave" onclick="btnSave_Click" Text="Lưu" OnClientClick="return Save()"/>
                                        <asp:Button runat="server" ID="btnCreate" Text="Tạo mới"  onclick="btnCreate_Click"/>    
                                    </p>                                    
                                </div>
                            </div>
                        </asp:Panel>
                    </div><br class="clear"/><br />
                
                        <asp:HiddenField ID="hidKidHealthInformationID" runat="server" />
                        <asp:HiddenField ID="hidNamePage" runat="server" />
                        <asp:HiddenField ID="hidKidID" runat="server" />
                        <asp:HiddenField ID="hidKidFullName" runat="server" />
                        <asp:HiddenField ID="hidClassID" runat="server" />
                        <asp:HiddenField ID="hidClassName" runat="server" />
                        <asp:HiddenField ID="hidParentID" runat="server" />
                 </form>

            <%
            /* Check Kid heal information or not */
                if (_dttKidHeal.Rows.Count > 0)
                {%>

			    <table width="100%">
                    <tr>
                        <td>
                            <!--<div id="content">-->
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" />
                                    </div>
                                    <div class="details">

                                        <div>
                                            <asp:Label ID="Label20" runat="server" Text='Kết quả' />
                                            <span id="startrecord"></span>-<span id="endrecord"></span>
                                            <asp:Label ID="Label21" runat="server" Text='của' />
                                            <span id="totalrecords"></span>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.reset()">
                                                <asp:Label ID="Label23" runat="server" Text='Thiết lập lại' /></a></div>
                                    </div>
                                </div>

                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                            <tr>
                                                <!--vị trí header list-->
                                                <th rowspan="2" style="vertical-align:middle;">
                                                    <h3>
                                                        <asp:Label ID="Label1" runat="server" Text='Ngày'></asp:Label></h3>
                                                </th>
                                                <th colspan="2" class="nosort" style="text-align: center;border-bottom:none;">
                                                    <h3>
                                                        <asp:Label ID="Label8" runat="server" Text='Cân nặng'></asp:Label></h3>
                                                </th>
                                                <th colspan="2" class="nosort" style="text-align: center;border-bottom:none;">
                                                    <h3>
                                                        <asp:Label ID="Label9" runat="server" Text='Chiều cao'></asp:Label></h3>
                                                </th>
                                                <th rowspan="2" class="nosort" style="text-align: center;vertical-align:middle;">
                                                    <h3>
                                                        <asp:Label ID="Label6" runat="server" Text='Kết luận'></asp:Label></h3>
                                                </th>
                                                <th rowspan="2" class="nosort" style="text-align: center;vertical-align:middle;">
                                                    <h3>
                                                        <asp:Label ID="Label10" runat="server" Text='Đăng bởi'></asp:Label></h3>
                                                </th>
                                                <th rowspan="2" class="nosort" style="text-align: center;vertical-align:middle;">
                                                    <h3>
                                                        <asp:Label ID="Label11" runat="server" Text='Sửa'></asp:Label></h3>
                                                </th>
                                                <th rowspan="2" class="nosort" style="text-align: center;vertical-align:middle;">
                                                    <h3>
                                                        <asp:Label ID="Label7" runat="server" Text='Xóa'></asp:Label></h3>
                                                </th>
                                            </tr>
                                            <tr>
                                                <th style="text-align: center;">
                                                    <h3>
                                                        <asp:Label ID="Label5" runat="server" Text='(kg)'></asp:Label></h3>
                                                </th>
                                                <th style="text-align: center;">
                                                    <h3>
                                                        <asp:Label ID="Label2" runat="server" Text='Tình trạng'></asp:Label></h3>
                                                </th>
                                                <th style="text-align: center;">
                                                    <h3>
                                                        <asp:Label ID="Label3" runat="server" Text='(cm)'></asp:Label></h3>
                                                </th>
                                                <th style="text-align: center;">
                                                    <h3>
                                                        <asp:Label ID="Label4" runat="server" Text='Tình trạng'></asp:Label></h3>
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <!--vị trí content list-->

                                            <% for (int i = 0; i < _dttKidHeal.Rows.Count; i++)
                                               {
                                            %>
                                            <tr>
                                                <td style="text-align: center; width:70px;">
                                                    <%= _general.ConvertDate_1(_dttKidHeal.Rows[i]["CreateDate"].ToString())%>
                                                </td>
                                                <td style="text-align: center; width:40px;">
                                                    <%= _dttKidHeal.Rows[i]["KidWeight"].ToString()%>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%= _general.ReplaceSpecialCharacters(_dttKidHeal.Rows[i]["WeightNotice"].ToString())%>
                                                </td>
                                                <td style="text-align: center; width:40px;">
                                                    <%= _dttKidHeal.Rows[i]["KidHeight"].ToString()%>
                                                </td>
                                                <td style="text-align: center;">
                                                    <%= _general.ReplaceSpecialCharacters(_dttKidHeal.Rows[i]["HeightNotice"].ToString())%>
                                                </td>
                                                <td>
                                                    <%= _general.ReplaceSpecialCharacters(_dttKidHeal.Rows[i]["Result"].ToString())%>
                                                </td>
                                                <td style="text-align: center; width:120px;">
                                                    <%= _general.ReplaceSpecialCharacters(_dttKidHeal.Rows[i]["FullName"].ToString())%>
                                                </td>
                                                <td style="text-align: center; width:50px;">
                                                    <form method="post" action="KidHealthDetails.aspx?KidID=<%= hidKidID.Value %>&KidFullName=<%= hidKidFullName.Value%>&hidNamePage=<%=hidNamePage.Value %>&hidClassID=<%=hidClassID.Value%>&hidClassName=<%=hidClassName.Value%>&hidParentID=<%=hidParentID.Value%>" >
                                                        <input type="hidden" id="hidden1" name="hidEditKidInformationID" value="<%= _dttKidHeal.Rows[i]["KidInformationID"].ToString() %>" />
                                                        <button type="submit" title="Sửa bản tin" >
                                                            <img alt="" src="layout/table/images/grid_edit.png" />
                                                        </button>
                                                    </form>
                                                </td>
                                                <td style="text-align: center; width:50px;">
                                                    <form method="post" action="KidHealthDetails.aspx?KidID=<%= hidKidID.Value %>&KidFullName=<%= hidKidFullName.Value%>&hidNamePage=<%=hidNamePage.Value %>&hidClassID=<%=hidClassID.Value%>&hidClassName=<%=hidClassName.Value%>&hidParentID=<%=hidParentID.Value%>" >
                                                        <input type="hidden" id="hidden6" name="hidKidInformationID" value="<%= _dttKidHeal.Rows[i]["KidInformationID"].ToString() %>" />
                                                        <button type="submit" title="Xóa bản tin" onclick="javascript: if (confirm('Bạn muốn xóa thông tin sức khỏe này của bé <%= hidKidFullName.Value %>?')) { window.location.href='#' } else { return false; };">
                                                            <img alt="" src="layout/table/images/delete.png" />
                                                        </button>
                                                    </form>
                                                </td>

                                            </tr>
                                            <% }%>
                                    
                                        </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img src="layout/table/images/first.gif" alt=""/>
                                            <img src="layout/table/images/first.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1,true)" />
                                            <img src="layout/table/images/previous.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1)" />
                                            <img src="layout/table/images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                                            <img src="layout/table/images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown">
                                            </select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">
                                                <asp:Label ID="Label25" runat="server" Text='Xem tất cả' /></a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="5">5</option>
                                                <option value="10">10</option>
                                                <option value="20" selected="selected">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                            </select>
                                            <span>
                                                <asp:Label ID="Label24" runat="server" Text='Kết quả mỗi trang' /></span>
                                        </div>
                                        <div class="page">
                                            <asp:Label ID="Label55" runat="server" Text='Trang' />
                                            <span id="currentpage"></span>
                                            <asp:Label ID="Label26" runat="server" Text='của' />
                                            <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="layout/table/5.js"></script> <!--vị trí có tham số không sort trên grid đếm từ phải qua trái-->
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 10,
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    /*
                                    sortcolumn: 0,
                                    sortdir: -1,
                                    sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                            <!--</div>-->
                        </td>
                    </tr>
                </table>

              <%} %>

              <% else{ %>
                    <br />
                    <h4 style="color: Blue;">Hiện bé <%= hidKidFullName.Value%> chưa có thông tin sức khỏe nào.</h4>
                <%} %>
            </div>
        </div>
    </div>
<!-- End one column tab content window -->



</asp:Content>
